package com.celi.scs.system.controller;

import com.celi.cii.base.ResponseDTO;
import com.celi.scs.common.entity.DeptDTO;
import com.celi.scs.common.service.SystemService;
import com.celi.system.entity.Dept;
import com.celi.system.entity.DictItem;
import com.celi.system.service.DictItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author jiangshengjun
 * @Date 2024/6/28
 * @Description 自定义推送
 */

@RestController
@RequestMapping("${url.prefix}/system")
public class SystemController {

    @Autowired
    private SystemService systemService;
    @Autowired
    private DictItemService dictItemService;

    /**
     * 查询一级部门
     * @return 实例对象
     */
    @GetMapping("/findLevel1Dept")
    public ResponseDTO<Dept> findLevel1Dept() {
        return ResponseDTO.ok(systemService.findLevel1Dept());
    }

    @GetMapping("/listDeptUsers")
    public ResponseDTO<List<DeptDTO>> listDeptUsers() {
        return ResponseDTO.ok(systemService.listDeptUsers());
    }

    @GetMapping("/queryDictItemsByGroupCode")
    public ResponseDTO<List<DictItem>> queryByGroupCode(String groupCode) {
        return ResponseDTO.ok(dictItemService.findAllByDictCode(groupCode));
    }

}
